/**
*      author: Y_Yao
*      created: 2025-01-16 21:36:00
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 5e5 + 6;
int a[N];
int n;

bool check(int i,int mid)
{
    if(a[mid] >= a[i] * 2)
    {
        return true;
    }
    return false;
}

void solve()
{
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
    }

    int ans = 0;
    for(int i = 1;i <= n;i++)
    {
        int l = i,r = n;
        while(l < r)
        {
            int mid = (l + r) >> 1;
            if(check(i,mid))
            {
                r = mid;
            }
            else
            {
                l = mid + 1;
            }
        }
        if(a[l] < a[i] * 2)
        {
            continue;
        }
        //cout << l << endl;
        ans += n - l + 1;
       // cout << ans << endl;
    }
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}